﻿@model ThaireInvestmentWeb.Models.EditExtraInstallmentModel
@{
    ViewBag.Title = "EditLoanExtraIntallment";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(document).ready(function () {

        $("#Extrainstallment_CloseAccountDate,#Extrainstallment_ExtrainstallmentDate").datepicker(
            {
                dateFormat: 'dd/mm/yy',
                yearRange: "-30:+40",
                showOn: 'button',
                showAnim: 'fadeIn',
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                buttonImage: '@Url.Content("~/Content/images/Calendar.png")', // '../../Content/images/Calendar.png',
            });

        $("#CancelBtn").click(function (event) {
            showConfirm(null, CancelBtnAction);
            return false;
        });
        $("#ScreenData_HeaderDTO_Installment").change(FormatNumber2Digits);
        $("#Extrainstallment_NewInstallment").change(FormatNumber2Digits);
        $("#Extrainstallment_ExtrainstallmentRate").change(FormatNumber2Digits);

    });

        function CancelBtnAction(event) {
            window.location.href = 'EditLoanHeader?headerId=@Model.HeaderID';
        }

</script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<table class="navi" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td style="width: 100%;">
            <div class="navi">
                Instrument Type > <a href="@Url.Action("ManageLoan", "Loan", new { headerId = Model.Header.LoansHeaderID })">Loans</a> > <a href="@Url.Action("EditLoanHeader", "Loan", new { headerId = Model.Header.LoansHeaderID })">Header</a> > Extra Installment
            </div>
        </td>
    </tr>
</table>
<table class="tableheader" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td height="38" align="center" style="width: 100%; text-align: center;">Extra Installment</td>
    </tr>
</table>

<table width="100%" border="0" align="center">
    <tr>
        <td>
            @*@Html.Partial("_LoanHeaderView", Model.ScreenData.HeaderDTO)*@
            @Html.ValidationSummary(true)
            @using (Html.BeginForm("EditLoanExtraIntallment", "Loan", FormMethod.Post, new { id = "mainForm" }))
            {
                
                <table class="tableform" width="100%" border="5" align="center" cellspacing="2">
                    <tr>
                        <td width="212">
                            <div align="right">ชื่อบริษัท: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">@Html.TextBoxFor(model => model.Header.CompanyName, new { @readonly = "readonly" , style = "width: 250px;" })</td>
                        <td width="188" align="right">
                            <div align="right">Maturity Status:</div>
                        </td>
                        <td>&nbsp;</td>
                        <td width="208">@Html.TextBoxFor(model => model.Header.MaturityStatus, new { @readonly = "readonly" })</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">เลขที่สัญญาเงินกู้: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">@Html.TextBoxFor(model => model.Header.ContractNumber, new { @readonly = "readonly" })</td>
                        <td>
                            <div align="right">ชื่อผู้กู้: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.Header.BorrowerName, new { @readonly = "readonly" , style = "width: 200px;" })</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">ระยะเวลาเริ่มต้น : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Header.ContractStartDate, new { @readonly = "readonly" , @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Header.ContractStartDate) })
                        </td>
                        <td>
                            <div align="right">ระยะเวลาสิ้นสุด : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.Header.ContractEndDate, new { @readonly = "readonly" , @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Header.ContractEndDate) })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">จำนวนเงินตามสัญญา: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Header.ContractAmount, new { @readonly = "readonly", @class = "inputNumberField" , @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Header.ContractAmount)})
                            BAHT</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>


                    <tr>
                        <td>
                            <div align="right">Period: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.ScreenData.HeaderDTO.Period, new { @readonly = "readonly" })
                            YEAR</td>
                        <td>
                            <div align="right">Installment/Month: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.TextBoxFor(model => model.ScreenData.HeaderDTO.Installment, new { @class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.ScreenData.HeaderDTO.Installment) }) 
                            BAHT

                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">&nbsp;</td>
                        <td>
                            <div align="right">&nbsp;Installment Update Date: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <input name="buy32306" type="text" id="buy32306" disabled value="" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">Interest Rate Update: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            <input name="buy32300" type="text" id="buy32300"
                                disabled value="" /></td>
                        <td>
                            <div align="right">Interest : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <input name="buy32301" type="text" id="buy32301" disabled value="" />
                            %</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="left">
                                <input type="radio" name="inst" />
                                New Installment Rate:
                            </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Extrainstallment.NewInstallment, new { @class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Extrainstallment.NewInstallment) })
                            @Html.ValidationMessageFor(model => model.Extrainstallment.NewInstallment)
                            BAHT</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <div align="left">
                                <input type="radio" name="inst" />
                                Extra Installment Rate
                                <br />
                            </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">Extra Installment Date: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.TextBoxFor(model => model.Extrainstallment.ExtrainstallmentDate, new {style = "width: 80px;", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Extrainstallment.ExtrainstallmentDate) })
                            @Html.ValidationMessageFor(model => model.Extrainstallment.ExtrainstallmentDate)
                            (Ex.31/12/2014)
                        </td>
                        <td>
                            <div align="right">Extra Installment Rate: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Extrainstallment.ExtrainstallmentRate, new {@class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Extrainstallment.ExtrainstallmentRate) })
                            @Html.ValidationMessageFor(model => model.Extrainstallment.ExtrainstallmentRate)

                            BAHT</td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <div align="left">
                                <input type="radio" name="inst" />
                                Close Account  
                            </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">Close Account Date: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.TextBoxFor(model => model.Extrainstallment.CloseAccountDate, new { style = "width: 80px;",@Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Extrainstallment.CloseAccountDate) })
                            @Html.ValidationMessageFor(model => model.Extrainstallment.CloseAccountDate)
                            (Ex.31/12/2014)
                        </td>
                        <td>
                            <div align="right">Close Account Interest: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Extrainstallment.CloseAccountInterest, new { @readonly = "readonly", @class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Extrainstallment.CloseAccountInterest) })
                            BAHT</td>
                    </tr>
                    <tr>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="width: 236px; height: 4px;">&nbsp;</td>
                        <td>
                            <div align="right">Close Account Principle: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Extrainstallment.CloseAccountPrinciple, new { @readonly = "readonly", @class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Extrainstallment.CloseAccountPrinciple) })
                            BAHT</td>
                    </tr>
                    <tr>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="width: 236px; height: 4px;">&nbsp;</td>
                        <td>
                            <div align="right">Close Account Total: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.Extrainstallment.CloseAccountTotal, new { @readonly = "readonly", @class = "inputNumberField", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatCurrency2(@Model.Extrainstallment.CloseAccountTotal) })
                            BAHT</td>
                    </tr>
                    <tr>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="width: 236px; height: 4px;"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                    </tr>
                </table>
    
                <table width="95%" height="85" border="0" align="center">
                    <tr>
                        <td>
                            <div align="center">

                                <input id="SubmitBtn" type="submit" name="SubmitBtn" value=" Submit " class="button" need-confirm="true" />
                                &nbsp;&nbsp; 
                            <input id="CancelBtn" type="button" name="CancelBtn" value=" Cancel " class="button" />
                            </div>
                        </td>
                    </tr>

                </table>
    
                @Html.HiddenFor(x => x.UpdateMode);
                @Html.HiddenFor(x => x.HeaderID);
                @Html.HiddenFor(x => x.ExtrainstallmentID);

            }

        </td>
    </tr>
</table>

